package com.las.bot;

import com.google.common.collect.Sets;
import com.utils.SpiderHtml;

import java.util.Set;

public class Demo12 {

    public static void main(String[] args) throws Exception {
        String url = "https://www.yxdmgo.com/";
        Set<String> keys = Sets.newHashSet();
        keys.add("今天");
        String info = SpiderHtml.spiderByKeyWithHtml(url, keys);
        String[] split = info.split("\n");
        for (String str : split) {
            //System.out.println(str);
            String[] ems = str.split("<em><a");
            if(ems.length > 0){
                String name = SpiderHtml.guoHtml(ems[1]);
                String title = name.split("href=")[0];
                String newStr = title.replaceAll("title=", "");
                title = newStr.substring(1,newStr.length() - 2);
                System.out.println(title);
            }
        }


    }


}
